package Servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Do.user;


@WebServlet("/servlet/loginServlet")
public class loginServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setCharacterEncoding("gbk");
		user user = new user();
		String username = request.getParameter("username");
		String password = request.getParameter("password");
		
		PrintWriter out = response.getWriter();
		if(username.equals(user.getUsername())&&password.equals(user.getUsername())) {
			out.println("登陆成功");
		}
		else {
			out.println("<html>");
			out.println("<head>");
			out.println("<title>增加小组成功</title>");
			out.println("</head>");
			out.println("<body>");
			out.println("<h1 align=center>登录失败</h1>");
			out.println("<a href='../login.html'>返回登录</a>");
			out.println("</body>");
			out.println("</html>");
			
		}
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
